package com.ruoyi.web.controller.system;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysSchoolFallowback;
import com.ruoyi.system.service.ISysSchoolFallowbackService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 学员回访跟踪信息Controller
 * 
 * @author 杨皓焜
 * @date 2021-02-05
 */
@RestController
@RequestMapping("/system/fallowback")
public class SysSchoolFallowbackController extends BaseController
{
    @Autowired
    private ISysSchoolFallowbackService sysSchoolFallowbackService;

    /**
     * 查询学员回访跟踪信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:fallowback:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysSchoolFallowback sysSchoolFallowback)
    {
        startPage();
        List<SysSchoolFallowback> list = sysSchoolFallowbackService.selectSysSchoolFallowbackList(sysSchoolFallowback);
        return getDataTable(list);
    }

    /**
     * 导出学员回访跟踪信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:fallowback:export')")
    @Log(title = "学员回访跟踪信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SysSchoolFallowback sysSchoolFallowback)
    {
        List<SysSchoolFallowback> list = sysSchoolFallowbackService.selectSysSchoolFallowbackList(sysSchoolFallowback);
        ExcelUtil<SysSchoolFallowback> util = new ExcelUtil<SysSchoolFallowback>(SysSchoolFallowback.class);
        return util.exportExcel(list, "fallowback");
    }

    /**
     * 获取学员回访跟踪信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:fallowback:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(sysSchoolFallowbackService.selectSysSchoolFallowbackById(id));
    }

    /**
     * 新增学员回访跟踪信息
     */
    @PreAuthorize("@ss.hasPermi('system:fallowback:add')")
    @Log(title = "学员回访跟踪信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysSchoolFallowback sysSchoolFallowback)
    {
        return toAjax(sysSchoolFallowbackService.insertSysSchoolFallowback(sysSchoolFallowback));
    }

    /**
     * 修改学员回访跟踪信息
     */
    @PreAuthorize("@ss.hasPermi('system:fallowback:edit')")
    @Log(title = "学员回访跟踪信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysSchoolFallowback sysSchoolFallowback)
    {
        return toAjax(sysSchoolFallowbackService.updateSysSchoolFallowback(sysSchoolFallowback));
    }

    /**
     * 删除学员回访跟踪信息
     */
    @PreAuthorize("@ss.hasPermi('system:fallowback:remove')")
    @Log(title = "学员回访跟踪信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysSchoolFallowbackService.deleteSysSchoolFallowbackByIds(ids));
    }
}
